<html>
<head><meta charset="utf-8"><title>issue 2736 · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html">issue 2736</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="186122879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186122879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186122879">(Jan 20 2020 at 18:09)</a>:</h4>
<p>Hi, I would like to work on this issue, so I'm looking for some help</p>



<a name="186123007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186123007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186123007">(Jan 20 2020 at 18:11)</a>:</h4>
<p>For now I am looking for the place where ItemScope gets populated to start understangin what it does/ how it is used</p>



<a name="186129575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186129575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186129575">(Jan 20 2020 at 20:02)</a>:</h4>
<p><code>ItemScope</code> gets populated by the <code>DefCollector</code> (in <code>collector.rs</code>), in particular resolved imports get added <a href="https://github.com/rust-analyzer/rust-analyzer/blob/de2409702ba639f06cf340f5e3f3b7e671021d1b/crates/ra_hir_def/src/nameres/collector.rs#L439-L453" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/de2409702ba639f06cf340f5e3f3b7e671021d1b/crates/ra_hir_def/src/nameres/collector.rs#L439-L453">here</a></p>



<a name="186200210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186200210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186200210">(Jan 21 2020 at 16:31)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="129457">@Florian Diebold</span> , thanks for the suggestion. Trying to better understand the issue I took the test code <a href="https://github.com/rust-analyzer/rust-analyzer/issues/2736#issue-545049916" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2736#issue-545049916">here</a></p>



<a name="186200355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186200355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186200355">(Jan 21 2020 at 16:33)</a>:</h4>
<p>then ran <code>cargo xtask install --server</code> and made the setup in my editor (nvim) but what I get from what I see is that the name that gets resolved is the right one</p>



<a name="186200382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186200382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186200382">(Jan 21 2020 at 16:33)</a>:</h4>
<p>maybe there is something that I am not understanding correctly but I can't see it</p>



<a name="186200808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186200808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186200808">(Jan 21 2020 at 16:37)</a>:</h4>
<p>I think this might be because we use approximate name-based matching for goto def, if we fail to infer type</p>



<a name="186200843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186200843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186200843">(Jan 21 2020 at 16:37)</a>:</h4>
<p>Basically, as long as you have a single function named <code>foo</code> in the project, all calls to <code>.foo()</code> will resolve to it.</p>



<a name="186200929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186200929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186200929">(Jan 21 2020 at 16:38)</a>:</h4>
<p>But, for example, asking for the type of the expression in the editor should yield unknown</p>



<a name="186201641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186201641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186201641">(Jan 21 2020 at 16:44)</a>:</h4>
<p>ok! if I hover Bar it gives the trait and not the struct<br>
good to finally see it, thanks!</p>



<a name="186243669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186243669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186243669">(Jan 22 2020 at 00:32)</a>:</h4>
<p>checking <a href="https://github.com/rust-analyzer/rust-analyzer/blob/de2409702ba639f06cf340f5e3f3b7e671021d1b/crates/ra_hir_def/src/nameres/collector.rs#L439-L453" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/de2409702ba639f06cf340f5e3f3b7e671021d1b/crates/ra_hir_def/src/nameres/collector.rs#L439-L453">this line</a> it seems  that  by then the alias of a <code>use x;</code> and <code>use x as _;</code> are both <code>None</code>, so there is no way to distinguish them there. I think the next step would be to make it a <code>Some(Name(Text("_")))</code> again (or add a new variant?) in order to identify it? does this make sense?</p>



<a name="186266747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186266747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186266747">(Jan 22 2020 at 08:59)</a>:</h4>
<p>Yep, we need to explicitelly handle an alias which is <code>_</code> case there</p>



<a name="186297395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186297395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186297395">(Jan 22 2020 at 15:35)</a>:</h4>
<p>i'm still trying to find where are <code>import.alias</code>generated to prevent <code>use x as _</code> to have it as <code>None</code>. Any hint? rn I'm looking at <code>raw_items</code> in <code>ModCollector</code> but I still need to find where those come from</p>



<a name="186298302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186298302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186298302">(Jan 22 2020 at 15:44)</a>:</h4>
<p>raw imports are created <a href="https://github.com/rust-analyzer/rust-analyzer/blob/9b1465af322e311152a23c1f61f967bda2bffcee/crates/ra_hir_def/src/nameres/raw.rs#L330-L339" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/9b1465af322e311152a23c1f61f967bda2bffcee/crates/ra_hir_def/src/nameres/raw.rs#L330-L339">here</a></p>



<a name="186298547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186298547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186298547">(Jan 22 2020 at 15:46)</a>:</h4>
<p>and <a href="https://github.com/rust-analyzer/rust-analyzer/blob/9b1465af322e311152a23c1f61f967bda2bffcee/crates/ra_hir_def/src/path/lower/lower_use.rs#L37" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/9b1465af322e311152a23c1f61f967bda2bffcee/crates/ra_hir_def/src/path/lower/lower_use.rs#L37">here</a>'s where the alias is taken from the syntax; I suspect in the <code>as _</code> case, <code>tree.alias()</code> will be <code>Some</code>, but <code>a.name()</code> will be <code>None</code></p>



<a name="186298874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186298874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186298874">(Jan 22 2020 at 15:49)</a>:</h4>
<p>Thanks, those look promising</p>



<a name="186628875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186628875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186628875">(Jan 26 2020 at 16:54)</a>:</h4>
<p>Do you think <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_parser/src/grammar.rs#L226" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_parser/src/grammar.rs#L226">this</a> is related?</p>



<a name="186639391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186639391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186639391">(Jan 26 2020 at 21:40)</a>:</h4>
<p>that's the parsing code for aliases, but I don't think you need to change anything there. in the case of <code>use Foo as _</code>, this means <code>tree.alias()</code> will be there, but there will be no name. I think it's fine to just check whether there's no name; that means that we'll treat <code>use Foo as;</code> the same, but I think that's reasonable</p>



<a name="186641874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186641874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186641874">(Jan 26 2020 at 22:57)</a>:</h4>
<p>You were right here</p>
<blockquote>
<p>and <a href="https://github.com/rust-analyzer/rust-analyzer/blob/9b1465af322e311152a23c1f61f967bda2bffcee/crates/ra_hir_def/src/path/lower/lower_use.rs#L37" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/9b1465af322e311152a23c1f61f967bda2bffcee/crates/ra_hir_def/src/path/lower/lower_use.rs#L37">here</a>'s where the alias is taken from the syntax; I suspect in the <code>as _</code> case, <code>tree.alias()</code> will be <code>Some</code>, but <code>a.name()</code> will be <code>None</code></p>
</blockquote>
<p>but I had a harder time that what was due to actually check it<br>
<a href="/user_uploads/4715/0ZU3Y1DkpaEvtzPB61QxDK_G/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/0ZU3Y1DkpaEvtzPB61QxDK_G/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/0ZU3Y1DkpaEvtzPB61QxDK_G/pasted_image.png"></a></div>



<a name="186644880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/186644880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#186644880">(Jan 27 2020 at 00:30)</a>:</h4>
<p>(deleted)</p>



<a name="187097070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187097070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187097070">(Jan 31 2020 at 16:13)</a>:</h4>
<p>Should I make <a href="https://github.com/rust-analyzer/rust-analyzer/blob/de2409702ba639f06cf340f5e3f3b7e671021d1b/crates/ra_hir_def/src/nameres/collector.rs#L458-L499" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/de2409702ba639f06cf340f5e3f3b7e671021d1b/crates/ra_hir_def/src/nameres/collector.rs#L458-L499">update and update_recursive</a> have in <code>resolutions</code> a <code>bool</code> to signal a named import vs an unnamed one? Or would it be better to have another function to handle adding the <code>unnamed_traits</code> to <code>ItemScope</code>?</p>



<a name="187097478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187097478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187097478">(Jan 31 2020 at 16:17)</a>:</h4>
<p>btw just to be clear, only Traits should be added right? if <code>Foo</code> is a struct or enum /something else <code>use Foo as _;</code> has no other effect besides an <code>unused import</code>warning (to the best of my understanding)</p>



<a name="187097490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187097490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187097490">(Jan 31 2020 at 16:17)</a>:</h4>
<p>To my mind, a bool is viable if it adds not more than one or two simple if statements in the body of the function. Otherwise it means that we have totally different logic going on for different values of that boolean and that means you should explicitly create two functions to handle two totally different cases. It's up to you as an engineer to estimate what case you are currently in.</p>



<a name="187097676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187097676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> divma <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187097676">(Jan 31 2020 at 16:19)</a>:</h4>
<p>Well, I would go with a simple <code>bool</code> but I prefer to align with whatever you guys prefer. Specially since I don't fully get what most of the code does yet</p>



<a name="187098147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187098147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187098147">(Jan 31 2020 at 16:24)</a>:</h4>
<p>By the way, I like using a so-called <code>named boolean</code> technique, that I remember <span class="user-mention" data-user-id="133169">@matklad</span>  mentioned in one of his <a href="https://www.youtube.com/playlist?list=PLlb7e2G7aSpTfhiECYNI2EZ1uAluUqE_e" target="_blank" title="https://www.youtube.com/playlist?list=PLlb7e2G7aSpTfhiECYNI2EZ1uAluUqE_e">Rust eductational videos</a> <br>
It means that you convert a boolean to an enum of two values:</p>
<div class="codehilite"><pre><span></span><span class="k">enum</span> <span class="nc">ImportNamedness</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Named</span><span class="p">,</span><span class="w"> </span><span class="n">Unnamed</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="c1">// or much more laconic one:</span>
<span class="k">struct</span> <span class="nc">ImportIsNamed</span><span class="p">(</span><span class="n">boolean</span><span class="p">)</span><span class="w"> </span><span class="p">;</span><span class="w"></span>
</pre></div>


<p>Though I think you should choose whatever is appropriate for the case and leave this discussion for the code review.</p>



<a name="187098403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187098403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187098403">(Jan 31 2020 at 16:27)</a>:</h4>
<p>By the way, I've just come up with that newtype for a boolean and I now like this idea very much</p>



<a name="187099022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187099022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187099022">(Jan 31 2020 at 16:33)</a>:</h4>
<p>Hmm, it looks like we can invent a syntax for named parameters via newtypes:</p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">ModuleId</span><span class="p">(</span><span class="n">LocalModuleId</span><span class="p">);</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">TargetVisibility</span><span class="p">(</span><span class="n">Visibility</span><span class="p">);</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Resolutions</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="p">[(</span><span class="n">Name</span><span class="p">,</span><span class="w"> </span><span class="n">PerNs</span><span class="p">)]);</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Depth</span><span class="p">(</span><span class="kt">usize</span><span class="p">);</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">update_recursive</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">module_id</span>: <span class="nc">ModuleId</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">resolutions</span>: <span class="nc">Resolutions</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">vis</span>: <span class="nc">TargetVisibility</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">depth</span>: <span class="nc">Depth</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">);</span><span class="w"></span>
<span class="c1">// then call</span>
<span class="n">update_recursive</span><span class="p">(</span><span class="w"></span>
<span class="w">      </span><span class="n">ModuleId</span><span class="p">(</span><span class="n">some_local_module_id</span><span class="p">),</span><span class="w"></span>
<span class="w">      </span><span class="n">Resolutions</span><span class="p">(</span><span class="n">some_array_of_resolutions</span><span class="p">),</span><span class="w"></span>
<span class="w">      </span><span class="n">TargetVisibility</span><span class="p">(</span><span class="n">some_visibility</span><span class="p">),</span><span class="w"></span>
<span class="w">      </span><span class="n">Depth</span><span class="p">(</span><span class="mi">442</span><span class="p">)</span><span class="w"></span>
<span class="p">);</span><span class="w"></span>
</pre></div>



<a name="187162398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187162398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187162398">(Feb 01 2020 at 13:31)</a>:</h4>
<p>to get back to the original questions, it seems to make sense to me to make <code>resolutions</code> a <code>[(Option&lt;Name&gt;, PerNs)]</code>...</p>



<a name="187162449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/issue%202736/near/187162449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/issue.202736.html#187162449">(Feb 01 2020 at 13:32)</a>:</h4>
<blockquote>
<p>btw just to be clear, only Traits should be added right?</p>
</blockquote>
<p>if it makes things simpler, sure, but I think it'd be fine to not check this</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>